home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvglue10.arc / TVQFIELD.C < prev    next >
C/C++ Source or Header  |  1988-08-13  |  1KB  |  43 lines

  1. /*=======================================================*/
  2. /*  TVQFIELD.C                                           */
  3. /*                                                       */
  4. /*  (c) Copyright 1988 Ralf Brown                        */
  5. /*     All Rights Reserved                               */
  6. /*  May be freely copied for noncommercial use, so long  */
  7. /*  as this copyright notice remains intact, and any     */
  8. /*  changes are marked in the comment blocks preceding   */
  9. /*  functions.                                           */
  10. /*=======================================================*/
  11.  
  12. #include <string.h>
  13. #include "tvapi.h"
  14. #include "tvstream.h"
  15.  
  16. /*=============================================*/
  17. /* TVqry_field   get contents of input field   */
  18. /*   Ralf Brown 4/17/88                        */
  19. /*=============================================*/
  20.  
  21. int pascal TVqry_field(OBJECT win,int fld,int bufsize,char *buffer)
  22. {
  23.    unsigned int size = TVqry_fieldsize(win,fld) ;
  24.    BYTE *stream = (BYTE *)malloc(size+6) ;
  25.  
  26.    if (stream)
  27.       {
  28.       stream[0] = 0x1B ;
  29.       stream[1] = 0 ;
  30.       *((int *)(stream+2)) = size+2 ;
  31.       stream[4] = 0xF3 ;
  32.       stream[5] = fld ;
  33.       TVwin_stream(win,stream) ;
  34.       memcpy(buffer, (char *)(stream+6), (bufsize<size)?bufsize:size) ;
  35.       free(stream) ;
  36.       return TRUE ;
  37.       }
  38.    else
  39.       return FALSE ;
  40. }
  41.  
  42. /* End of TVQFIELD.C */
  43.